<?php
// Ensure this file is being included by a parent file
defined('_JEXEC') or die( 'Restricted access' );

/**
 * Radio List Element
 *
 */
if (class_exists('JFormField')){
	class JFormFieldPositions extends JFormField
	{
		
		/**
		 * Element name
		 *
		 * @access	protected
		 * @var		string
		 */
		var	$_name = 'YtPositions';
		function getInput( ) { 
			$db =& JFactory::getDBO();
			$query = "SELECT DISTINCT position FROM #__modules ORDER BY position ASC";
			$db->setQuery($query);
			$groups = $db->loadObjectList();
			
			$groupHTML = array();	
			if ($groups && count ($groups)) {
				foreach ($groups as $v=>$t){
					$groupHTML[] = JHTML::_('select.option', $t->position, $t->position);
				}
			}
			$lists = JHTML::_('select.genericlist', $groupHTML, $this->name.'[]', ' multiple="multiple"  size="10" ', 'value', 'text', $this->value);
			
			return $lists;
		}
	}
}
